<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>absolute定位</title>
  </head>
  <style>
    /* 
    相对定位：
       1.如果找不到这样的祖先元素，参照对象是视口
       2.- position值不为static的元素
          - 也就是position值为relative、absolute、fixed的元素

     */
    .content {
      width: 500px;
      height: 500px;
      background-color: pink;
    }

    .box {
      width: 300px;
      height: 300px;
      background-color: red;
      position: absolute;
      right: 50px;
      top: 50px;
    }

    a {
      position: absolute;
      right: 50px;
      top: 60px;
    }
  </style>

  <body>
    <div class="content">
      <div class="box">
        <a href="">a元素</a>
      </div>
    </div>
  </body>

</html>